﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MultWebApi.Models
{
    public class SysErrorCode
    {
        public const int KSuccess = 0;

        /// <summary>
        /// 权限不足
        /// </summary>
        public const int HttpErrorCode401 = 401;

        /// <summary>
        /// 入参错误
        /// </summary>
        public const int KInputParamInvalid = 10000;

        /// <summary>
        /// 失败
        /// </summary>
        public const int KFail = 10001;

        /// <summary>
        /// 密码格式错误
        /// </summary>
        public const int PwdFormatError = 10002;

        /// <summary>
        /// 身份验证错误
        /// </summary>
        public const int KAuthFail = 10003;


        /// <summary>
        /// token失效
        /// </summary>
        public const int KTokenInvalid = 10004;
    
        public static string GetErrorMessge(int code)
        {
            string msg = string.Empty;
            switch (code)
            {
                case HttpErrorCode401:msg = "权限不足";break;
                case KFail: msg = "请求失败"; break;
                case PwdFormatError: msg = "登录验证失败"; break;
                case KAuthFail: msg = "用户权限不足"; break;
                case KTokenInvalid: msg = "Token已过期"; break;
            }
            return msg;
        }
    }


}
